/* 
 * Enterprise Library Extensions - DI + ORM.
 * Copyright (C) 2006
 *
 * GNU General Public License
 *
 * This program is free software; you can redistribute 
 * it and/or modify it under the terms of the GNU General Public License 
 * as published by the Free Software Foundation; either version 2 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 */
using System;

namespace ELE.EnterpriseLibrary.Naming.Spi
{
	/// <summary>
	/// Summary description for ResolveResult.
	/// </summary>
	public class ResolveResult
	{
    /// <summary>
    /// Field containing the remaining name yet to be resolved. 
    /// </summary>
    protected  IName remainingName;
    /// <summary>
    /// Field containing the Object that was resolved to successfully. 
    /// </summary>
    protected  object resolvedObj; 
    /// <summary>
    /// Constructs an instance of ResolveResult with the resolved object and remaining name both initialized to null.
    /// </summary>
    public ResolveResult() 
    {
    }
    /// <summary>
    /// Constructs a new instance of ResolveResult consisting of the resolved Object and the remaining name. 
    /// </summary>
    /// <param name="robj">The non-null object resolved to</param>
    /// <param name="rname">The single remaining name component that has yet to be resolved. Cannot be null (but can be empty).</param>
   
    public ResolveResult(object robj, IName rname) 
    {
      resolvedObj = robj;
      remainingName = rname;
    }
    /// <summary>
    /// Constructs a new instance of ResolveResult consisting of the resolved object and the remaining unresolved component. 
    /// </summary>
    /// <param name="robj">The non-null object resolved to</param>
    /// <param name="rcomp">The non-null remaining name that has yet to be resolved.</param>
  
    public ResolveResult(object robj, string rcomp) 
    {
      resolvedObj = robj;
      remainingName = new CompositeName(rcomp);
    }
    /// <summary>
    /// 
    /// </summary>
    public IName RemainingName
    {
      get
      {
        return remainingName;
      }
      set
      {
        remainingName = value;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    public object ResolvedObject
    {
      get
      {
        return resolvedObj;
      }
      set
      {
        resolvedObj = value;
      }
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="name"></param>
    public void AppendRemainingName(IName name)
    {
      remainingName.AddAll(name);
    }
    /// <summary>
    /// 
    /// </summary>
    /// <param name="name"></param>
    public void AppendRemainingComponent(string name)
    {
      remainingName.Add(name);
    }
	}
}
